#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include "..\System\cuPrintf.cu"
#include "..\System\cuFalloc.cu"

#include "..\Scheduler\System\Scheduler\Element.hpp"
#include "..\Scheduler\System\Scheduler\SliceCollection.hpp"
using namespace System::Scheduler;

__device__ int TreeSet_COMPARE(unsigned __int32 shard, void* x, void* y)
{
	int a = *((int*)x);
	int b = *((int*)y);
    return (a < b ? -1 : (a > b ? 1 : 0));
}

__global__ void testScheduler(fallocDeviceHeap* deviceHeap)
{
	fallocInit(deviceHeap);

	Time::Element e; e.ScheduleStyle = Time::Multiple;
	e.A = 5;

	SliceCollection s; s.xtor(deviceHeap);
	s.Schedule(&e, 10);
	//s.MoveNextSlice();
	s.Dispose();
}

int main()
{
	cudaFallocHeap cuHeap = cudaFallocInit(256000);
	cudaPrintfInit(256000);

	// schedule
	testScheduler<<<1, 1>>>(cuHeap.deviceHeap);

	// free and exit
	cudaPrintfDisplay(stdout, true); cudaPrintfEnd();
	cudaFallocEnd(heap);
	printf("\ndone.\n"); //char c; scanf_s("%c", &c);
    return 0;
}

#include "..\Scheduler\System\Scheduler\SliceCollection.hpp"
